using EasyRoads3D;
using System.Collections.Generic;
using UnityEngine;

public class RoadObjectScript : MonoBehaviour
{
	public static string version = string.Empty;

	public int objectType;

	public bool displayRoad = true;

	public float roadWidth = 5f;

	public float indent = 3f;

	public float surrounding = 5f;

	public float raise = 1f;

	public float raiseMarkers = 0.5f;

	public bool OOQDOOQQ;

	public bool renderRoad = true;

	public bool beveledRoad;

	public bool applySplatmap;

	public int splatmapLayer = 4;

	public bool autoUpdate = true;

	public float geoResolution = 5f;

	public int roadResolution = 1;

	public float tuw = 15f;

	public int splatmapSmoothLevel;

	public float opacity = 1f;

	public int expand;

	public int offsetX;

	public int offsetY;

	private Material surfaceMaterial;

	public float surfaceOpacity = 1f;

	public float smoothDistance = 1f;

	public float smoothSurDistance = 3f;

	private bool handleInsertFlag;

	public bool handleVegetation = true;

	public float OCQQCOCCCQ = 2f;

	public float OODODDCCCQ = 1f;

	public int materialType;

	private string[] materialStrings;

	public string uname;

	public string email;

	private MarkerScript[] mSc;

	private bool OOCDOOCQOQ;

	private bool[] OCCOCODOCO;

	private bool[] OQODOOOOQC;

	public string[] OOCODCOQDQ;

	public string[] ODODQOQO;

	public int[] ODODQOQOInt;

	public int OCCCOCOQOC = -1;

	public int OOCOQOOODC = -1;

	public static GUISkin OCDQQDOODQ;

	public static GUISkin ODDOQQCQDC;

	public bool ODCQDCQDOC;

	private Vector3 cPos;

	private Vector3 ePos;

	public bool OCDQCOOOOC;

	public static Texture2D OCDCQCDOCC;

	public int markers = 1;

	public OOQCOQOQQD OOOOODODCQ;

	private GameObject ODOQDQOO;

	public bool OQCCDOOOCC;

	public bool doTerrain;

	private Transform OOCODCOCQQ;

	public GameObject[] OOCODCOCQQs;

	private static string ODCCQODQCO;

	public Transform obj;

	private string OQCDDDCQQO;

	public static string erInit = string.Empty;

	public static Transform ODCQQODDCO;

	private RoadObjectScript OQOCQODQCO;

	public bool flyby;

	private Vector3 pos;

	private float fl;

	private float oldfl;

	private bool OQQOQDDQQQ;

	private bool OOODCQDCOQ;

	private bool OCOQDCOCCQ;

	public Transform OCCOCOOOCC;

	public int OdQODQOD = 1;

	public float OOQQQDOD;

	public float OOQQQDODOffset;

	public float OOQQQDODLength;

	public bool ODODDDOO;

	public static string[] ODOQDOQO;

	public static string[] ODODOQQO;

	public static string[] ODODQOOQ;

	public int ODQDOOQO;

	public string[] ODQQQQQO;

	public string[] ODODDQOO;

	public bool[] ODODQQOD;

	public int[] OOQQQOQO;

	public int ODOQOOQO;

	public bool forceY;

	public float yChange;

	public float floorDepth = 2f;

	public float waterLevel = 1.5f;

	public bool lockWaterLevel = true;

	public float lastY;

	public string distance = "0";

	public string markerDisplayStr = "Hide Markers";

	public static string[] objectStrings;

	public string objectText = "Road";

	public bool applyAnimation;

	public float waveSize = 1.5f;

	public float waveHeight = 0.15f;

	public bool snapY = true;

	private TextAnchor origAnchor;

	public bool autoODODDQQO;

	public Texture2D roadTexture;

	public Texture2D roadMaterial;

	public string[] ODCDCDCCDO;

	public string[] OQDDDDCQOQ;

	public int selectedWaterMaterial;

	public int selectedWaterScript;

	private bool doRestore;

	public bool doFlyOver;

	public static GameObject tracer;

	public Camera goCam;

	public float speed = 1f;

	public float offset;

	public bool camInit;

	public GameObject customMesh;

	public static bool disableFreeAlerts = true;

	public bool multipleTerrains;

	public bool editRestore = true;

	public Material roadMaterialEdit;

	public static int backupLocation;

	public string[] backupStrings = new string[2]
	{
		"Outside Assets folder path",
		"Inside Assets folder path"
	};

	public Vector3[] leftVecs = new Vector3[0];

	public Vector3[] rightVecs = new Vector3[0];

	public bool applyTangents;

	public bool sosBuild;

	public float splinePos;

	public float camHeight = 3f;

	public Vector3 splinePosV3 = Vector3.zero;

	public bool blendFlag;

	public float startBlendDistance = 5f;

	public float endBlendDistance = 5f;

	public bool iOS;

	public static string extensionPath = string.Empty;

	public void ODODCDOOQC(List<ODODDQQO> arr, string[] DOODQOQO, string[] OODDQOQO)
	{
		OCQOQOCQDC(base.transform, arr, DOODQOQO, OODDQOQO);
	}

	public void OQCQDQCDQO(MarkerScript markerScript)
	{
		OOCODCOCQQ = markerScript.transform;
		List<GameObject> list = new List<GameObject>();
		for (int i = 0; i < OOCODCOCQQs.Length; i++)
		{
			if (OOCODCOCQQs[i] != markerScript.gameObject)
			{
				list.Add(OOCODCOCQQs[i]);
			}
		}
		list.Add(markerScript.gameObject);
		OOCODCOCQQs = list.ToArray();
		OOCODCOCQQ = markerScript.transform;
		OOOOODODCQ.OOQDOCCDQO(OOCODCOCQQ, OOCODCOCQQs, markerScript.OQODDCOODQ, markerScript.OOQQQOCQCD, OCCOCOOOCC, out markerScript.OOCODCOCQQs, out markerScript.trperc, OOCODCOCQQs);
		OOCOQOOODC = -1;
	}

	public void ODQOCODDCQ(MarkerScript markerScript)
	{
		if (markerScript.OOQQQOCQCD != markerScript.ODOOQQOO || markerScript.OOQQQOCQCD != markerScript.ODOOQQOO)
		{
			OOOOODODCQ.OOQDOCCDQO(OOCODCOCQQ, OOCODCOCQQs, markerScript.OQODDCOODQ, markerScript.OOQQQOCQCD, OCCOCOOOCC, out markerScript.OOCODCOCQQs, out markerScript.trperc, OOCODCOCQQs);
			markerScript.ODQDOQOO = markerScript.OQODDCOODQ;
			markerScript.ODOOQQOO = markerScript.OOQQQOCQCD;
		}
		if (OQOCQODQCO.autoUpdate)
		{
			ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
		}
	}

	public void ResetMaterials(MarkerScript markerScript)
	{
		if (OOOOODODCQ != null)
		{
			OOOOODODCQ.OOQDOCCDQO(OOCODCOCQQ, OOCODCOCQQs, markerScript.OQODDCOODQ, markerScript.OOQQQOCQCD, OCCOCOOOCC, out markerScript.OOCODCOCQQs, out markerScript.trperc, OOCODCOCQQs);
		}
	}

	public void OOODQCCQDD(MarkerScript markerScript)
	{
		if (markerScript.OOQQQOCQCD != markerScript.ODOOQQOO)
		{
			OOOOODODCQ.OOQDOCCDQO(OOCODCOCQQ, OOCODCOCQQs, markerScript.OQODDCOODQ, markerScript.OOQQQOCQCD, OCCOCOOOCC, out markerScript.OOCODCOCQQs, out markerScript.trperc, OOCODCOCQQs);
			markerScript.ODOOQQOO = markerScript.OOQQQOCQCD;
		}
		ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
	}

	private void OOCQQQOODD(string ctrl, MarkerScript markerScript)
	{
		int num = 0;
		Transform[] oOCODCOCQQs = markerScript.OOCODCOCQQs;
		foreach (Transform transform in oOCODCOCQQs)
		{
			MarkerScript component = transform.GetComponent<MarkerScript>();
			if (ctrl == "rs")
			{
				component.LeftSurrounding(markerScript.rs - markerScript.ODOQQOOO, markerScript.trperc[num]);
			}
			else if (ctrl == "ls")
			{
				component.RightSurrounding(markerScript.ls - markerScript.DODOQQOO, markerScript.trperc[num]);
			}
			else if (ctrl == "ri")
			{
				component.LeftIndent(markerScript.ri - markerScript.OOQOQQOO, markerScript.trperc[num]);
			}
			else if (ctrl == "li")
			{
				component.RightIndent(markerScript.li - markerScript.ODODQQOO, markerScript.trperc[num]);
			}
			else if (ctrl == "rt")
			{
				component.LeftTilting(markerScript.rt - markerScript.ODDQODOO, markerScript.trperc[num]);
			}
			else if (ctrl == "lt")
			{
				component.RightTilting(markerScript.lt - markerScript.ODDOQOQQ, markerScript.trperc[num]);
			}
			else if (ctrl == "floorDepth")
			{
				component.FloorDepth(markerScript.floorDepth - markerScript.oldFloorDepth, markerScript.trperc[num]);
			}
			num++;
		}
	}

	public void OOODDQDQQO()
	{
		if (markers > 1)
		{
			ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
		}
	}

	public void OCQOQOCQDC(Transform tr, List<ODODDQQO> arr, string[] DOODQOQO, string[] OODDQOQO)
	{
		version = "2.5.9";
		OCDQQDOODQ = (GUISkin)Resources.Load("ER3DSkin", typeof(GUISkin));
		OCDCQCDOCC = (Texture2D)Resources.Load("ER3DLogo", typeof(Texture2D));
		if (objectStrings == null)
		{
			objectStrings = new string[3];
			objectStrings[0] = "Road Object";
			objectStrings[1] = "River Object";
			objectStrings[2] = "Procedural Mesh Object";
		}
		obj = tr;
		OOOOODODCQ = new OOQCOQOQQD();
		OQOCQODQCO = obj.GetComponent<RoadObjectScript>();
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				OCCOCOOOCC = item;
			}
		}
		RoadObjectScript[] array = (RoadObjectScript[])UnityEngine.Object.FindObjectsOfType(typeof(RoadObjectScript));
		OOQCOQOQQD.terrainList.Clear();
		Terrain[] array2 = (Terrain[])UnityEngine.Object.FindObjectsOfType(typeof(Terrain));
		Terrain[] array3 = array2;
		foreach (Terrain terrain in array3)
		{
			Terrains terrains = new Terrains();
			terrains.terrain = terrain;
			if (!terrain.gameObject.GetComponent<EasyRoads3DTerrainID>())
			{
				EasyRoads3DTerrainID easyRoads3DTerrainID = terrain.gameObject.AddComponent<EasyRoads3DTerrainID>();
				terrains.id = (easyRoads3DTerrainID.terrainid = UnityEngine.Random.Range(100000000, 999999999).ToString());
			}
			else
			{
				terrains.id = terrain.gameObject.GetComponent<EasyRoads3DTerrainID>().terrainid;
			}
			OOOOODODCQ.OCDCQQCDDC(terrains);
		}
		OQCQQDCCCO.OCDCQQCDDC();
		if (roadMaterialEdit == null)
		{
			roadMaterialEdit = (Material)Resources.Load("materials/roadMaterialEdit", typeof(Material));
		}
		if (objectType == 0 && GameObject.Find(base.gameObject.name + "/road") == null)
		{
			GameObject gameObject = new GameObject("road");
			gameObject.transform.parent = base.transform;
		}
		OOOOODODCQ.OOOODCDDQD(obj, ODCCQODQCO, OQOCQODQCO.roadWidth, surfaceOpacity, out OCDQCOOOOC, out indent, applyAnimation, waveSize, waveHeight);
		OOOOODODCQ.OODODDCCCQ = OODODDCCCQ;
		OOOOODODCQ.OCQQCOCCCQ = OCQQCOCCCQ;
		OOOOODODCQ.OdQODQOD = OdQODQOD + 1;
		OOOOODODCQ.OOQQQDOD = OOQQQDOD;
		OOOOODODCQ.OOQQQDODOffset = OOQQQDODOffset;
		OOOOODODCQ.OOQQQDODLength = OOQQQDODLength;
		OOOOODODCQ.objectType = objectType;
		OOOOODODCQ.snapY = snapY;
		OOOOODODCQ.terrainRendered = OQCCDOOOCC;
		OOOOODODCQ.handleVegetation = handleVegetation;
		OOOOODODCQ.raise = raise;
		OOOOODODCQ.roadResolution = roadResolution;
		OOOOODODCQ.multipleTerrains = multipleTerrains;
		OOOOODODCQ.editRestore = editRestore;
		OOOOODODCQ.roadMaterialEdit = roadMaterialEdit;
		OOOOODODCQ.renderRoad = renderRoad;
		OOOOODODCQ.rscrpts = array.Length;
		OOOOODODCQ.blendFlag = blendFlag;
		OOOOODODCQ.startBlendDistance = startBlendDistance;
		OOOOODODCQ.endBlendDistance = endBlendDistance;
		OOOOODODCQ.iOS = iOS;
		if (backupLocation == 0)
		{
			ODQQDOOOOO.backupFolder = "/EasyRoads3D";
		}
		else
		{
			ODQQDOOOOO.backupFolder = ODQQDOOOOO.extensionPath + "/Backups";
		}
		ODODQOQO = OOOOODODCQ.OCDCOOOOQC();
		ODODQOQOInt = OOOOODODCQ.OCQQCCDCDD();
		if (OQCCDOOOCC)
		{
			doRestore = true;
		}
		OQOQQQCDOQ();
		if (arr != null || ODODQOOQ == null)
		{
			OCODODQDDO(arr, DOODQOQO, OODDQOQO);
		}
		if (!doRestore)
		{
		}
	}

	public void UpdateBackupFolder()
	{
	}

	public void ODQQCODQDC()
	{
		if ((!ODODDDOO || objectType == 2) && OCCOCODOCO != null)
		{
			for (int i = 0; i < OCCOCODOCO.Length; i++)
			{
				OCCOCODOCO[i] = false;
				OQODOOOOQC[i] = false;
			}
		}
	}

	public void OQDCOOOOQC(Vector3 pos)
	{
		if (!displayRoad)
		{
			displayRoad = true;
			OOOOODODCQ.OOQCQOCOOC(displayRoad, OCCOCOOOCC);
		}
		pos.y += OQOCQODQCO.raiseMarkers;
		if (forceY && ODOQDQOO != null)
		{
			float num = Vector3.Distance(pos, ODOQDQOO.transform.position);
			Vector3 position = ODOQDQOO.transform.position;
			pos.y = position.y + yChange * (num / 100f);
		}
		else if (forceY && markers == 0)
		{
			lastY = pos.y;
		}
		GameObject gameObject = null;
		gameObject = ((!(ODOQDQOO != null)) ? (UnityEngine.Object.Instantiate(Resources.Load("marker", typeof(GameObject))) as GameObject) : UnityEngine.Object.Instantiate(ODOQDQOO));
		Transform transform = gameObject.transform;
		transform.position = pos;
		transform.parent = OCCOCOOOCC;
		markers++;
		string name = (markers < 10) ? ("Marker000" + markers.ToString()) : ((markers >= 100) ? ("Marker0" + markers.ToString()) : ("Marker00" + markers.ToString()));
		transform.gameObject.name = name;
		MarkerScript component = transform.GetComponent<MarkerScript>();
		foreach (Transform item in gameObject.transform)
		{
			if (item.name == "surface")
			{
				component.surface = item;
				if ((bool)item.GetComponent<MeshFilter>())
				{
					if (item.GetComponent<MeshFilter>().sharedMesh == null)
					{
						item.GetComponent<MeshFilter>().sharedMesh = new Mesh();
					}
					if ((bool)item.GetComponent<MeshCollider>())
					{
						item.GetComponent<MeshCollider>().sharedMesh = item.GetComponent<MeshFilter>().sharedMesh;
					}
				}
			}
		}
		component.OCDQCOOOOC = false;
		component.objectScript = obj.GetComponent<RoadObjectScript>();
		if (ODOQDQOO == null)
		{
			component.waterLevel = OQOCQODQCO.waterLevel;
			component.floorDepth = OQOCQODQCO.floorDepth;
			component.ri = OQOCQODQCO.indent;
			component.li = OQOCQODQCO.indent;
			component.rs = OQOCQODQCO.surrounding;
			component.ls = OQOCQODQCO.surrounding;
			component.tension = 0.5f;
			if (objectType == 1)
			{
				pos.y -= waterLevel;
				transform.position = pos;
			}
		}
		if (objectType == 2 && component.surface != null)
		{
			component.surface.gameObject.SetActive(value: false);
		}
		ODOQDQOO = transform.gameObject;
		if (markers > 1)
		{
			ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
			if (materialType == 0)
			{
				OOOOODODCQ.OCCDCCQDCQ(materialType);
			}
		}
	}

	public void ODQCCQDQQC(float geo, bool renderMode, bool camMode)
	{
		OOOOODODCQ.OCDQDDDDCO.Clear();
		int num = 0;
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				foreach (Transform item2 in item)
				{
					MarkerScript component = item2.GetComponent<MarkerScript>();
					component.objectScript = obj.GetComponent<RoadObjectScript>();
					if (!component.OCDQCOOOOC)
					{
						component.OCDQCOOOOC = OOOOODODCQ.OCODDOQQDO(item2);
					}
					ODQOOCQDQD oDQOOCQDQD = new ODQOOCQDQD();
					oDQOOCQDQD.position = item2.position;
					oDQOOCQDQD.num = OOOOODODCQ.OCDQDDDDCO.Count;
					oDQOOCQDQD.object1 = item2;
					oDQOOCQDQD.object2 = component.surface;
					oDQOOCQDQD.tension = component.tension;
					oDQOOCQDQD.ri = component.ri;
					if (oDQOOCQDQD.ri < 1f)
					{
						oDQOOCQDQD.ri = 1f;
					}
					oDQOOCQDQD.li = component.li;
					if (oDQOOCQDQD.li < 1f)
					{
						oDQOOCQDQD.li = 1f;
					}
					oDQOOCQDQD.rt = component.rt;
					oDQOOCQDQD.lt = component.lt;
					oDQOOCQDQD.rs = component.rs;
					if (oDQOOCQDQD.rs < 1f)
					{
						oDQOOCQDQD.rs = 1f;
					}
					oDQOOCQDQD.OQQQOOOQQQ = component.rs;
					oDQOOCQDQD.ls = component.ls;
					if (oDQOOCQDQD.ls < 1f)
					{
						oDQOOCQDQD.ls = 1f;
					}
					oDQOOCQDQD.OQDDOOQCOC = component.ls;
					oDQOOCQDQD.renderFlag = component.bridgeObject;
					oDQOOCQDQD.OOQOCDCQDD = component.distHeights;
					oDQOOCQDQD.newSegment = component.newSegment;
					oDQOOCQDQD.tunnelFlag = component.tunnelFlag;
					oDQOOCQDQD.floorDepth = component.floorDepth;
					oDQOOCQDQD.waterLevel = waterLevel;
					oDQOOCQDQD.lockWaterLevel = component.lockWaterLevel;
					oDQOOCQDQD.sharpCorner = component.sharpCorner;
					oDQOOCQDQD.OQCQOCOOQD = OOOOODODCQ;
					component.markerNum = num;
					component.distance = "-1";
					component.OCOQOQCDCD = "-1";
					OOOOODODCQ.OCDQDDDDCO.Add(oDQOOCQDQD);
					num++;
				}
			}
		}
		distance = "-1";
		OOOOODODCQ.OOOQDCCOCD = OQOCQODQCO.roadWidth;
		OOOOODODCQ.OOOOQCCQOO(geo, obj, OQOCQODQCO.OOQDOOQQ, renderMode, camMode, objectType);
		if (OOOOODODCQ.leftVecs.Count > 0)
		{
			leftVecs = OOOOODODCQ.leftVecs.ToArray();
			rightVecs = OOOOODODCQ.rightVecs.ToArray();
		}
	}

	public void StartCam()
	{
		ODQCCQDQQC(0.5f, renderMode: false, camMode: true);
	}

	public void OQOQQQCDOQ()
	{
		int num = 0;
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				num = 1;
				foreach (Transform item2 in item)
				{
					string text2 = item2.name = ((num >= 10) ? ((num >= 100) ? ("Marker0" + num.ToString()) : ("Marker00" + num.ToString())) : ("Marker000" + num.ToString()));
					ODOQDQOO = item2.gameObject;
					num++;
				}
			}
		}
		markers = num - 1;
		ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
	}

	public List<Transform> RebuildObjs()
	{
		RoadObjectScript[] array = (RoadObjectScript[])UnityEngine.Object.FindObjectsOfType(typeof(RoadObjectScript));
		List<Transform> list = new List<Transform>();
		RoadObjectScript[] array2 = array;
		foreach (RoadObjectScript roadObjectScript in array2)
		{
			if (roadObjectScript.transform != base.transform)
			{
				list.Add(roadObjectScript.transform);
			}
		}
		return list;
	}

	public void RestoreTerrain1()
	{
		ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
		if (OOOOODODCQ != null)
		{
			OOOOODODCQ.OOOQOODDOC();
		}
		ODODDDOO = false;
	}

	public void ODCDQOOOQC()
	{
		OOOOODODCQ.ODCDQOOOQC(OQOCQODQCO.applySplatmap, OQOCQODQCO.splatmapSmoothLevel, OQOCQODQCO.renderRoad, OQOCQODQCO.tuw, OQOCQODQCO.roadResolution, OQOCQODQCO.raise, OQOCQODQCO.opacity, OQOCQODQCO.expand, OQOCQODQCO.offsetX, OQOCQODQCO.offsetY, OQOCQODQCO.beveledRoad, OQOCQODQCO.splatmapLayer, OQOCQODQCO.OdQODQOD, OOQQQDOD, OOQQQDODOffset, OOQQQDODLength);
	}

	public void OQOQQDOQDQ()
	{
		OOOOODODCQ.OQOQQDOQDQ(OQOCQODQCO.renderRoad, OQOCQODQCO.tuw, OQOCQODQCO.roadResolution, OQOCQODQCO.raise, OQOCQODQCO.beveledRoad, OQOCQODQCO.OdQODQOD, OOQQQDOD, OOQQQDODOffset, OOQQQDODLength);
	}

	public void OQODDQOODQ(Vector3 pos, bool doInsert)
	{
		if (!displayRoad)
		{
			displayRoad = true;
			OOOOODODCQ.OOQCQOCOOC(displayRoad, OCCOCOOOCC);
		}
		int first = -1;
		int second = -1;
		float dist = 10000f;
		float dist2 = 10000f;
		Vector3 tmpPos = pos;
		ODQOOCQDQD k = OOOOODODCQ.OCDQDDDDCO[0];
		ODQOOCQDQD k2 = OOOOODODCQ.OCDQDDDDCO[1];
		if (doInsert)
		{
		}
		OOOOODODCQ.OOOCDCDQDD(pos, out first, out second, out dist, out dist2, out k, out k2, out tmpPos, doInsert);
		if (doInsert)
		{
		}
		pos = tmpPos;
		if (doInsert && first >= 0 && second >= 0)
		{
			if (OQOCQODQCO.OOQDOOQQ && second == OOOOODODCQ.OCDQDDDDCO.Count - 1)
			{
				OQDCOOOOQC(pos);
			}
			else
			{
				ODQOOCQDQD oDQOOCQDQD = OOOOODODCQ.OCDQDDDDCO[second];
				string name = oDQOOCQDQD.object1.name;
				int num = second + 2;
				for (int i = second; i < OOOOODODCQ.OCDQDDDDCO.Count - 1; i++)
				{
					oDQOOCQDQD = OOOOODODCQ.OCDQDDDDCO[i];
					string name2 = (num >= 10) ? ((num >= 100) ? ("Marker0" + num.ToString()) : ("Marker00" + num.ToString())) : ("Marker000" + num.ToString());
					oDQOOCQDQD.object1.name = name2;
					num++;
				}
				oDQOOCQDQD = OOOOODODCQ.OCDQDDDDCO[first];
				Transform transform = (Transform)UnityEngine.Object.Instantiate(oDQOOCQDQD.object1.transform, pos, oDQOOCQDQD.object1.rotation);
				transform.gameObject.name = name;
				transform.parent = OCCOCOOOCC;
				transform.SetSiblingIndex(second);
				MarkerScript component = transform.GetComponent<MarkerScript>();
				component.OCDQCOOOOC = false;
				float num2 = dist + dist2;
				float num3 = dist / num2;
				float num4 = k.ri - k2.ri;
				component.ri = k.ri - num4 * num3;
				num4 = k.li - k2.li;
				component.li = k.li - num4 * num3;
				num4 = k.rt - k2.rt;
				component.rt = k.rt - num4 * num3;
				num4 = k.lt - k2.lt;
				component.lt = k.lt - num4 * num3;
				num4 = k.rs - k2.rs;
				component.rs = k.rs - num4 * num3;
				num4 = k.ls - k2.ls;
				component.ls = k.ls - num4 * num3;
				ODQCCQDQQC(OQOCQODQCO.geoResolution, renderMode: false, camMode: false);
				if (materialType == 0)
				{
					OOOOODODCQ.OCCDCCQDCQ(materialType);
				}
				if (objectType == 2)
				{
					component.surface.gameObject.SetActive(value: false);
				}
			}
		}
		OQOQQQCDOQ();
	}

	public void OCDCCCOCDD()
	{
		UnityEngine.Object.DestroyImmediate(OQOCQODQCO.OOCODCOCQQ.gameObject);
		OOCODCOCQQ = null;
		OQOQQQCDOQ();
	}

	public void OCCCDOQDOD()
	{
		OOOOODODCQ.OOQODOOQOD(12);
	}

	public List<SideObjectParams> OOCCOOODOO()
	{
		List<SideObjectParams> list = new List<SideObjectParams>();
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				foreach (Transform item2 in item)
				{
					MarkerScript component = item2.GetComponent<MarkerScript>();
					SideObjectParams sideObjectParams = new SideObjectParams();
					sideObjectParams.ODDGDOOO = component.ODDGDOOO;
					sideObjectParams.ODDQOODO = component.ODDQOODO;
					sideObjectParams.ODDQOOO = component.ODDQOOO;
					list.Add(sideObjectParams);
				}
			}
		}
		return list;
	}

	public void OCCDOOOOCC()
	{
		List<string> list = new List<string>();
		List<int> list2 = new List<int>();
		List<string> list3 = new List<string>();
		for (int i = 0; i < ODODOQQO.Length; i++)
		{
			if (ODODQQOD[i])
			{
				list.Add(ODODQOOQ[i]);
				list3.Add(ODODOQQO[i]);
				list2.Add(i);
			}
		}
		ODODDQOO = list.ToArray();
		OOQQQOQO = list2.ToArray();
	}

	public void OCODODQDDO(List<ODODDQQO> arr, string[] DOODQOQO, string[] OODDQOQO)
	{
		bool flag = false;
		ODODOQQO = DOODQOQO;
		ODODQOOQ = OODDQOQO;
		List<MarkerScript> list = new List<MarkerScript>();
		if (obj == null)
		{
			OCQOQOCQDC(base.transform, null, null, null);
		}
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				foreach (Transform item2 in item)
				{
					MarkerScript component = item2.GetComponent<MarkerScript>();
					component.OQODQQDO.Clear();
					component.ODOQQQDO.Clear();
					component.OQQODQQOO.Clear();
					component.ODDOQQOO.Clear();
					list.Add(component);
				}
			}
		}
		mSc = list.ToArray();
		List<bool> list2 = new List<bool>();
		int num = 0;
		int num2 = 0;
		if (ODQQQQQO != null)
		{
			if (arr.Count == 0)
			{
				return;
			}
			for (int i = 0; i < ODODOQQO.Length; i++)
			{
				ODODDQQO oDODDQQO = arr[i];
				for (int j = 0; j < ODQQQQQO.Length; j++)
				{
					if (!(ODODOQQO[i] == ODQQQQQO[j]))
					{
						continue;
					}
					num++;
					if (ODODQQOD.Length > j)
					{
						list2.Add(ODODQQOD[j]);
					}
					else
					{
						list2.Add(item: false);
					}
					MarkerScript[] array = mSc;
					foreach (MarkerScript markerScript in array)
					{
						int num3 = -1;
						for (int l = 0; l < markerScript.ODDOOQDO.Length; l++)
						{
							if (oDODDQQO.id == markerScript.ODDOOQDO[l])
							{
								num3 = l;
								break;
							}
						}
						if (num3 >= 0)
						{
							markerScript.OQODQQDO.Add(markerScript.ODDOOQDO[num3]);
							markerScript.ODOQQQDO.Add(markerScript.ODDGDOOO[num3]);
							markerScript.OQQODQQOO.Add(markerScript.ODDQOOO[num3]);
							if (oDODDQQO.sidewaysDistanceUpdate == 0 || (oDODDQQO.sidewaysDistanceUpdate == 2 && markerScript.ODDQOODO[num3] != oDODDQQO.oldSidwaysDistance))
							{
								markerScript.ODDOQQOO.Add(markerScript.ODDQOODO[num3]);
							}
							else
							{
								markerScript.ODDOQQOO.Add(oDODDQQO.splinePosition);
							}
						}
						else
						{
							markerScript.OQODQQDO.Add(oDODDQQO.id);
							markerScript.ODOQQQDO.Add(oDODDQQO.markerActive);
							markerScript.OQQODQQOO.Add(item: true);
							markerScript.ODDOQQOO.Add(oDODDQQO.splinePosition);
						}
					}
				}
				if (oDODDQQO.sidewaysDistanceUpdate != 0)
				{
				}
				flag = false;
			}
		}
		for (int m = 0; m < ODODOQQO.Length; m++)
		{
			ODODDQQO oDODDQQO2 = arr[m];
			bool flag2 = false;
			for (int n = 0; n < ODQQQQQO.Length; n++)
			{
				if (ODODOQQO[m] == ODQQQQQO[n])
				{
					flag2 = true;
				}
			}
			if (!flag2)
			{
				num2++;
				list2.Add(item: false);
				MarkerScript[] array2 = mSc;
				foreach (MarkerScript markerScript2 in array2)
				{
					markerScript2.OQODQQDO.Add(oDODDQQO2.id);
					markerScript2.ODOQQQDO.Add(oDODDQQO2.markerActive);
					markerScript2.OQQODQQOO.Add(item: true);
					markerScript2.ODDOQQOO.Add(oDODDQQO2.splinePosition);
				}
			}
		}
		ODODQQOD = list2.ToArray();
		ODQQQQQO = new string[ODODOQQO.Length];
		ODODOQQO.CopyTo(ODQQQQQO, 0);
		List<int> list3 = new List<int>();
		for (int num5 = 0; num5 < ODODQQOD.Length; num5++)
		{
			if (ODODQQOD[num5])
			{
				list3.Add(num5);
			}
		}
		OOQQQOQO = list3.ToArray();
		MarkerScript[] array3 = mSc;
		foreach (MarkerScript markerScript3 in array3)
		{
			markerScript3.ODDOOQDO = markerScript3.OQODQQDO.ToArray();
			markerScript3.ODDGDOOO = markerScript3.ODOQQQDO.ToArray();
			markerScript3.ODDQOOO = markerScript3.OQQODQQOO.ToArray();
			markerScript3.ODDQOODO = markerScript3.ODDOQQOO.ToArray();
		}
		if (!flag)
		{
		}
	}

	public void SetMultipleTerrains(bool flag)
	{
		RoadObjectScript[] array = (RoadObjectScript[])UnityEngine.Object.FindObjectsOfType(typeof(RoadObjectScript));
		RoadObjectScript[] array2 = array;
		foreach (RoadObjectScript roadObjectScript in array2)
		{
			roadObjectScript.multipleTerrains = flag;
			if (roadObjectScript.OOOOODODCQ != null)
			{
				roadObjectScript.OOOOODODCQ.multipleTerrains = flag;
			}
		}
	}

	public bool CheckWaterHeights()
	{
		if (OQCQQDCCCO.terrain == null)
		{
			return false;
		}
		bool result = true;
		Vector3 position = OQCQQDCCCO.terrain.transform.position;
		float y = position.y;
		foreach (Transform item in obj)
		{
			if (item.name == "Markers")
			{
				foreach (Transform item2 in item)
				{
					Vector3 position2 = item2.position;
					if (position2.y - y <= 0.1f)
					{
						result = false;
					}
				}
			}
		}
		return result;
	}
}
